import HttpService from '../../app/services/httpService.js';

class CompanyService extends HttpService {
    constructor($http, $q){
        super($http, $q)

        this.URL = this.baseUrl();

        this.OBJ = {
        	CompanyListUrl: this.URL + '/company/lists',
            CompanyCreateUrl: this.URL + '/company/create',
            CompanyDetailUrl: this.URL + '/company/detail?company_id=',
            CompanyUpdateUrl: this.URL + '/company/update?company_id=',
            CompanyExistsUrl: this.URL + '/race/companyExists?company_name=',
            CompanyClubsUrl: this.URL + '/company/getClubs'
        }

    }

    /* 赛事机构列表 */
    getCompanyList(headers) {
        return this.getRequest(this.OBJ.CompanyListUrl, headers);
    }

    /* 创建公司 */
    postCompanyCreate(params, headers) {
        return this.postMultipart(this.OBJ.CompanyCreateUrl, params, headers);
    }

    /* 获取公司详情 */
    getCompanyDetail(headers, search) {
        return this.getRequest(this.OBJ.CompanyDetailUrl, headers, search);
    }

    /* 更新公司 */
    postCompanyUpdate(params, headers, search) {
        return this.postMultipart(this.OBJ.CompanyUpdateUrl, params, headers, search);
    }

    /* 公司名称查重 */
    getCompanyExists(headers, search) {
        return this.getRequest(this.OBJ.CompanyExistsUrl, headers, search);
    }

    /* 查询跑团创建 */
    getClubs(search) {
        return this.getRequest(this.OBJ.CompanyClubsUrl, search);
    }
}

export default CompanyService;